package Ants.Model;

import java.util.ArrayList;
import java.util.List;

public class Alert implements  Comparable<Alert> {

	private List<Ant> myAnts = new ArrayList<Ant>();
	private List<Ant> enemyAnts = new ArrayList<Ant>();
	private List<Ant> ignoredEnemies = new ArrayList<Ant>();
	
	private List<Tile> myHills = new ArrayList<Tile>();
	private List<Tile> enemyHills = new ArrayList<Tile>();
	private List<Tile> food = new ArrayList<Tile>();
	
	private AlertType type = AlertType.ENEMY;
	
	private Ant center;
	
	private int friendsCounter;
	private int enemiesCounter;
	
	public int getFriendsCounter() {
		return friendsCounter;
	}

	public void setFriendsCounter(int friendsCounter) {
		this.friendsCounter = friendsCounter;
	}

	public int getEnemiesCounter() {
		return enemiesCounter;
	}

	public void setEnemiesCounter(int enemiesCounter) {
		this.enemiesCounter = enemiesCounter;
	}

	public List<Tile> getFood() {
		return food;
	}

	public void setFood(List<Tile> food) {
		this.food = food;
	}

	public List<Ant> getMyAnts() {
		return myAnts;
	}

	public void setMyAnts(List<Ant> myAnts) {
		this.myAnts = myAnts;
	}

	public List<Ant> getEnemyAnts() {
		return enemyAnts;
	}

	public void setEnemyAnts(List<Ant> enemyAnts) {
		this.enemyAnts = enemyAnts;
	}

	public List<Tile> getMyHills() {
		return myHills;
	}

	public void setMyHills(List<Tile> myHills) {
		this.myHills = myHills;
	}

	public List<Tile> getEnemyHills() {
		return enemyHills;
	}

	public void setEnemyHills(List<Tile> enemyHills) {
		this.enemyHills = enemyHills;
	}

	public AlertType getType() {
		return type;
	}

	public void setType(AlertType type) {
		this.type = type;
	}

	public void setChecked(boolean checked){
		for (Ant ant : myAnts){
			ant.getTile().setChecked(checked);
		}
	}

	public Ant getCenter() {
		return center;
	}

	public void setCenter(Ant center) {
		this.center = center;
	}

	public List<Ant> getIgnoredEnemies() {
		return ignoredEnemies;
	}

	public void setIgnoredEnemies(List<Ant> ignoredEnemies) {
		this.ignoredEnemies = ignoredEnemies;
	}

	@Override
	public int compareTo(Alert o) {
		if(myAnts.size() + enemyAnts.size() > o.myAnts.size() + o.enemyAnts.size()){
			return 1;
		}				
		else if(myAnts.size() + enemyAnts.size() == o.myAnts.size() + o.enemyAnts.size() && myAnts.size() > o.myAnts.size()){
			return 1;
		}	
		else if(myAnts.size() + enemyAnts.size() == o.myAnts.size() + o.enemyAnts.size()){
			return 0;
		}	
		else{
			return -1;
		}	
	}

}